#!/bin/bash
#USAGE flag "-b --bazel" help="Use binary built by Bazel"

set -eo pipefail

cmd=""

if [ "$usage_bazel" = "true" ]; then
    echo "INFO: Using Bazel"
    bazel build //:periphery
    cmd='bazel-bin/Sources/Frontend_opt scan --config /var/tmp/periphery_bazel/periphery.yml --generic-project-config bazel-bin/external/+generated+periphery_generated/rule/project_config.json'
else
    mise r build --arch arm64
    cmd='./.build/release/periphery scan --quiet --skip-build'
fi

echo $cmd
hyperfine --warmup 3 "${cmd}"
